#ifndef GUI_H
#define GUI_H

typedef unsigned int    coord;
typedef unsigned short  color;

#define MAKE_COLOR(bg, fg)  ((color)((((char)(bg))<<8)|((char)(fg))))

enum Gui_Mode {
    GUI_MODE_NONE = 0,
    GUI_MODE_ALT,
    GUI_MODE_MENU,
    GUI_MODE_PALETTE,
    GUI_MODE_MBOX,
    GUI_MODE_REVERSI,
    GUI_MODE_SOKOBAN,
    GUI_MODE_DEBUG,
    GUI_MODE_FSELECT,
    GUI_MODE_READ,
    GUI_MODE_OSD,
    GUI_MODE_CALENDAR,
    GUI_MODE_BENCH,
    GUI_MODE_MPOPUP,
    GUI_MODE_4WINS,
    GUI_MODE_MASTERMIND,
    GUI_MODE_TETRIS};

extern void gui_redraw();
extern void gui_force_restore();

//extern void draw_pixel(coord x, coord y, color cl);
extern char*    frame_buffer[2];
extern unsigned int    screen_width, screen_height, screen_size;
extern unsigned int    screen_buffer_width, screen_buffer_height, screen_buffer_size;

static inline void __attribute__((always_inline)) draw_pixel(coord x, coord y, color cl) {
    if (x >= screen_width || y >= screen_height) return;
    else {
        register unsigned int offset = y * screen_buffer_width + x;
        //draw_pixel_proc(offset, cl);
        frame_buffer[0][offset] = frame_buffer[1][offset] = cl & 0xff;
   }
}

extern enum Gui_Mode gui_get_mode();
extern void gui_set_mode(enum Gui_Mode mode);

#ifdef OPT_SCRIPTING
extern void gui_update_script_submenu();
#endif

#endif
